#include <types.h>
#include <machine.h>
#include <arch/machine.h>
#include <arch/arm.h>
#include <errno.h>

struct machine_desc *machine_lookup(void)
{
	struct machine_desc *md;
	struct machine_arm_desc *arm_md;
	uint32_t cpuid;

	cpuid = get_cpuid_id();
	for_each_machine_desc(md) {
		arm_md = md->priv;	
		if ((cpuid & arm_md->cpu_mask) == arm_md->cpu_val) 
			return md;
	}

	return ERR_PTR(-ENODEV);
}

